package com.changcheng.explorer.event;

import com.changcheng.explorer.R;
import com.changcheng.explorer.service.FileListService;
import android.view.MenuItem;

/**
 * 菜单事件
 * @author Administrator
 *
 */
public class MenuEvent {
	
	@SuppressWarnings("unused")
	private static final String TAG = "MenuEvent";
	
	public static boolean execute(final FileListService fileListService, MenuItem item)
			throws Exception {
		CharSequence title = item.getTitle();
		if (title.equals(fileListService.getMainActivity().getString(
				R.string.edit_new_folder))) {
			// 新建目录
			fileListService.mkDir();
		} else if (title.equals(fileListService.getMainActivity().getString(
				R.string.edit_cut))) {
			// 剪切
			fileListService.cut();
		} else if (title.equals(fileListService.getMainActivity().getString(
				R.string.edit_copy))) {
			// 复制
			fileListService.copy();
		} else if (title.equals(fileListService.getMainActivity().getString(
				R.string.edit_paste))) {
			// 粘贴
			fileListService.paste();
		} else if (title.equals(fileListService.getMainActivity().getString(
				R.string.edit_delete))) {
			// 删除
			fileListService.delete();
		} else if (title.equals(fileListService.getMainActivity().getString(
				R.string.edit_rename))) {
			// 重命名
			fileListService.rename();
		} 
		return true;
	}
}
